package cn.tedu.medicalmanagementsystem.user.mapper;

import cn.tedu.medicalmanagementsystem.user.pojo.dto.UserLoginParam;
import cn.tedu.medicalmanagementsystem.user.pojo.dto.UserUpdateParam;
import cn.tedu.medicalmanagementsystem.user.pojo.entity.User;
import cn.tedu.medicalmanagementsystem.user.pojo.vo.UserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;;

@Mapper
public interface UserMapper {
    // 插入用户数据
    int insert(User user);

    // 根据用户名查询用户
    User selectByUsername(String username);

    // 根据ID查询用户详情
    User selectById(Long id);

    // 检查电话号码是否存在
    int phoneExists(String phone);
    // 检查用户名是否存在
    int usernameExists(String username);

    // 检查邮箱是否存在
    int emailExists(String email);
    //修改用户信息
    int update(UserUpdateParam userUpdateParam);

    User selectByPhone(@Param("phone") String phone);
    UserVO selectByUsernameAndPassword(@Param("username") String username,
                                       @Param("password") String password);

    UserVO selectByPhoneAndPassword(UserLoginParam userLoginParam);

    Integer countsAppointment(Long id);

    Integer countsReview(Long id);

    Integer countsFavorite(Long id);
}
